﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.Utilities;
using System.Web;
using System.Web.UI.WebControls;

namespace ContentTypeUsageSolution
{
    public class ViewUsage : Microsoft.SharePoint.WebControls.LayoutsPageBase
    {
        protected Repeater Repeater1;

        protected override void OnLoad(EventArgs e)
        {
        }

        protected override void CreateChildControls()
        {
            string ctype = HttpContext.Current.Request["ctype"];
            SPContentTypeId ctypeid = new SPContentTypeId(ctype);

            SPContentType contenttype = SPContext.Current.Web.ContentTypes[ctypeid];
            IList<SPContentTypeUsage> usages = SPContentTypeUsage.GetUsages(contenttype);
            Repeater1.DataSource = usages;
            Repeater1.DataBind();

            base.CreateChildControls();
        }
    }
}
